namespace CIS.Customer
{
    using CISLib;
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    public class CustomerInfoSearchPage : Page
    {
        protected Button addTimeTypeBtn;
        protected DropDownList areaDdl;
        protected DropDownList catDdl;
        protected TextBox CompanyNameTbx;
        protected TextBox CompanyTxb;
        protected TextBox CouponTxb;
        protected DropDownList CustomerLevelDdl;
        protected TextBox CustomerNameTbx;
        protected TextBox CustomerTitleTbx;
        protected DropDownList DegreeDdl;
        protected Button delTimeTypeBtn;
        protected TextBox editorTxb;
        protected TextBox GraduateSchoolTxb;
        protected TextBox HotelTxb;
        protected TextBox ImageInfoTxb;
        protected Image iSearch;
        protected Label lbAreaDdl;
        protected Label lbASBReception;
        protected Label lbBasicInfo;
        protected Label lbCatDdl;
        protected Label lbCompany;
        protected Label lbCompanyName;
        protected Label lbCoupon;
        protected Label lbCustomerLevel;
        protected Label lbCustomerName;
        protected Label lbCustomerTitle;
        protected Label lbDegree;
        protected Label lbEditor;
        protected Label lbFrom;
        protected Label lbFromD;
        protected Label lbFromM;
        protected Label lbFromY;
        protected Label lbGraduateSchool;
        protected Label lbHotel;
        protected Label lbImage;
        protected Label lbMajor;
        protected Label lbNewsPaper;
        protected Label lbPreferencesType;
        protected Label lbPreferencesValue;
        protected Label lbRegionDdl;
        protected Label lbStudyingExperience;
        protected Label lbTimeType;
        protected Label lbTo;
        protected Label lbToD;
        protected Label lbToM;
        protected Label lbTour;
        protected Label lbToY;
        protected Label lbTravelHotel;
        protected Label lbTravelTool;
        protected Label lbWorkingExperience;
        protected Label lbWorkingPlace;
        protected TextBox MajorTxb;
        protected DropDownList MeetingEndDateDdl;
        protected DropDownList MeetingEndMonthDdl;
        protected DropDownList MeetingEndYearDdl;
        protected DropDownList MeetingStartDateDdl;
        protected DropDownList MeetingStartMonthDdl;
        protected DropDownList MeetingStartYearDdl;
        protected DropDownList paperTypeDdl;
        protected DropDownList PrefTypeDdl;
        protected DropDownList PrefValueDdl;
        protected UserPrincipal Principal = null;
        protected DropDownList regionDdl;
        protected Button searchBtn;
        protected ListBox selectedTimeLB;
        protected DropDownList timeTypeDdl;
        protected TextBox TourTxb;
        protected DropDownList TravelToolDdl;
        protected TextBox WorkPlaceTxb;

        private void addTimeTypeBtn_Click(object sender, EventArgs e)
        {
            try
            {
                string startYear = this.MeetingStartYearDdl.SelectedItem.Text;
                string startMonth = this.MeetingStartMonthDdl.SelectedItem.Text;
                string startDate = this.MeetingStartDateDdl.SelectedItem.Text;
                string endYear = this.MeetingEndYearDdl.SelectedItem.Text;
                string endMonth = this.MeetingEndMonthDdl.SelectedItem.Text;
                string endDate = this.MeetingEndDateDdl.SelectedItem.Text;
                if ((((startYear != "----") && (startMonth != "--")) && ((startDate != "--") && (endYear != "----"))) && ((endMonth != "--") && (endDate != "--")))
                {
                    ListItem tmpItem = new ListItem();
                    tmpItem.Text = this.timeTypeDdl.SelectedItem.Text + " from:" + startYear + "-" + startMonth + "-" + startDate + " To:" + endYear + "-" + endMonth + "-" + endDate;
                    tmpItem.Value = this.timeTypeDdl.SelectedItem.Value + "@" + startYear + "-" + startMonth + "-" + startDate + "@" + endYear + "-" + endMonth + "-" + endDate;
                    if (!this.IsExistItem(tmpItem, this.selectedTimeLB))
                    {
                        this.selectedTimeLB.Items.Add(tmpItem);
                    }
                }
            }
            catch
            {
            }
        }

        private void areaDdl_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.catDdl.Items.Clear();
            this.catDdl.DataSource = ManageCAT.GetCAT(new Guid(this.areaDdl.SelectedValue));
            this.catDdl.DataTextField = "CATGroupName";
            this.catDdl.DataValueField = "CATGroupId";
            this.catDdl.DataBind();
            this.regionDdl.DataSource = ManageProvince.GetProvince(new Guid(this.areaDdl.SelectedValue));
            this.regionDdl.DataTextField = "RegionName";
            this.regionDdl.DataValueField = "RegionId";
            this.regionDdl.DataBind();
        }

        private void delTimeTypeBtn_Click(object sender, EventArgs e)
        {
            try
            {
                this.selectedTimeLB.Items.Remove(this.selectedTimeLB.Items[this.selectedTimeLB.SelectedIndex]);
            }
            catch
            {
            }
        }

        private void InitializeComponent()
        {
            this.PrefTypeDdl.SelectedIndexChanged += new EventHandler(this.PrefTypeDdl_SelectedIndexChanged);
            this.addTimeTypeBtn.Click += new EventHandler(this.addTimeTypeBtn_Click);
            this.delTimeTypeBtn.Click += new EventHandler(this.delTimeTypeBtn_Click);
            this.searchBtn.Click += new EventHandler(this.searchBtn_Click);
            this.areaDdl.SelectedIndexChanged += new EventHandler(this.areaDdl_SelectedIndexChanged);
            base.Load += new EventHandler(this.Page_Load);
        }

        private void InitPage()
        {
            this.SetFromImage();
            this.SetFrom();
            this.DegreeDdl.Items.Clear();
            ListItem tmpItem00 = new ListItem();
            ListItem tmpItem11 = new ListItem();
            ListItem tmpItem22 = new ListItem();
            ListItem tmpItem33 = new ListItem();
            ListItem tmpItem44 = new ListItem();
            ListItem tmpItem55 = new ListItem();
            ListItem tmpItem66 = new ListItem();
            ListItem tmpItem77 = new ListItem();
            ListItem tmpItem88 = new ListItem();
            ListItem tmpItemNull = new ListItem();
            ListItem tmpItemA = new ListItem();
            ListItem tmpItemB = new ListItem();
            ListItem tmpItemC = new ListItem();
            ListItem tmpItemD = new ListItem();
            string language = this.Session["language"].ToString();
            if (language == "cn")
            {
                tmpItemNull.Text = "";
                tmpItemA.Text = "飞机";
                tmpItemB.Text = "火车";
                tmpItemC.Text = "汽车";
                tmpItemD.Text = "船只";
                tmpItemNull.Value = "";
                tmpItemA.Value = "1";
                tmpItemB.Value = "2";
                tmpItemC.Value = "3";
                tmpItemD.Value = "4";
                this.TravelToolDdl.Items.Add(tmpItemNull);
                this.TravelToolDdl.Items.Add(tmpItemA);
                this.TravelToolDdl.Items.Add(tmpItemB);
                this.TravelToolDdl.Items.Add(tmpItemC);
                this.TravelToolDdl.Items.Add(tmpItemD);
            }
            else if (language == "en")
            {
                tmpItemNull.Text = "";
                tmpItemA.Text = "Plane";
                tmpItemB.Text = "Train";
                tmpItemC.Text = "Auto";
                tmpItemD.Text = "Ship";
                tmpItemNull.Value = "";
                tmpItemA.Value = "1";
                tmpItemB.Value = "2";
                tmpItemC.Value = "3";
                tmpItemD.Value = "4";
                this.TravelToolDdl.Items.Add(tmpItemNull);
                this.TravelToolDdl.Items.Add(tmpItemA);
                this.TravelToolDdl.Items.Add(tmpItemB);
                this.TravelToolDdl.Items.Add(tmpItemC);
                this.TravelToolDdl.Items.Add(tmpItemD);
            }
            if (language == "cn")
            {
                tmpItem00.Text = "";
                tmpItem11.Text = "大专以下";
                tmpItem22.Text = "大专";
                tmpItem33.Text = "本科";
                tmpItem44.Text = "硕士";
                tmpItem55.Text = "博士";
                tmpItem66.Text = "MBA";
                tmpItem77.Text = "EMBA";
                tmpItem88.Text = "DBA";
                tmpItem00.Value = "";
                tmpItem11.Value = "大专以下";
                tmpItem22.Value = "大专";
                tmpItem33.Value = "本科";
                tmpItem44.Value = "硕士";
                tmpItem55.Value = "博士";
                tmpItem66.Value = "MBA";
                tmpItem77.Value = "EMBA";
                tmpItem88.Value = "DBA";
            }
            else if (language == "en")
            {
                tmpItem00.Text = "";
                tmpItem11.Text = "Below";
                tmpItem22.Text = "College";
                tmpItem33.Text = "Bachelor";
                tmpItem44.Text = "Master";
                tmpItem55.Text = "doctor";
                tmpItem66.Text = "MBA";
                tmpItem77.Text = "EMBA";
                tmpItem88.Text = "DBA";
                tmpItem00.Value = "";
                tmpItem11.Value = "大专以下";
                tmpItem22.Value = "大专";
                tmpItem33.Value = "本科";
                tmpItem44.Value = "硕士";
                tmpItem55.Value = "博士";
                tmpItem66.Value = "MBA";
                tmpItem77.Value = "EMBA";
                tmpItem88.Value = "DBA";
            }
            this.DegreeDdl.Items.Add(tmpItem00);
            this.DegreeDdl.Items.Add(tmpItem11);
            this.DegreeDdl.Items.Add(tmpItem22);
            this.DegreeDdl.Items.Add(tmpItem33);
            this.DegreeDdl.Items.Add(tmpItem44);
            this.DegreeDdl.Items.Add(tmpItem55);
            this.DegreeDdl.Items.Add(tmpItem66);
            this.DegreeDdl.Items.Add(tmpItem77);
            this.DegreeDdl.Items.Add(tmpItem88);
            Area[] area = ManageArea.GetAreaAryViaId(this.Principal.SysUser.UserId);
            this.PrefTypeDdl.DataSource = ManagePreference.GetPreferenceType(area[0].AreaId);
            if (language == "cn")
            {
                this.PrefTypeDdl.DataTextField = "PreferenceNameCn";
            }
            else if (language == "en")
            {
                this.PrefTypeDdl.DataTextField = "PreferenceNameEn";
            }
            this.PrefTypeDdl.DataValueField = "PreferenceId";
            this.PrefTypeDdl.DataBind();
            this.PrefValueDdl.DataSource = ManagePreference.GetPreferenceValue(new Guid(this.PrefTypeDdl.SelectedItem.Value));
            switch (language)
            {
                case "cn":
                    this.PrefValueDdl.DataTextField = "PreferenceValueNameCn";
                    break;

                case "en":
                    this.PrefValueDdl.DataTextField = "PreferenceValueNameEn";
                    break;
            }
            this.PrefValueDdl.DataValueField = "PreferenceValueId";
            this.PrefValueDdl.DataBind();
            this.MeetingStartYearDdl.Items.Clear();
            this.MeetingStartMonthDdl.Items.Clear();
            this.MeetingStartDateDdl.Items.Clear();
            ListItem tmpItem = new ListItem();
            tmpItem.Text = "----";
            this.MeetingStartYearDdl.Items.Add(tmpItem);
            ListItem tmpItem1 = new ListItem();
            tmpItem1.Text = "--";
            this.MeetingStartMonthDdl.Items.Add(tmpItem1);
            this.MeetingStartDateDdl.Items.Add(tmpItem1);
            this.CustomerLevelDdl.Items.Clear();
            for (int i = 0; i <= 5; i++)
            {
                string tmpStr = "Level " + i.ToString();
                ListItem tmpItemLevel = new ListItem();
                tmpItemLevel.Text = tmpStr;
                tmpItemLevel.Value = i.ToString();
                this.CustomerLevelDdl.Items.Add(tmpItemLevel);
            }
            this.CustomerLevelDdl.Items[0].Text = "";
            for (int i = DateTime.Now.Year; i >= 0x78a; i--)
            {
                ListItem YearItem = new ListItem();
                YearItem.Text = i.ToString();
                this.MeetingStartYearDdl.Items.Add(YearItem);
            }
            for (int i = 1; i <= 12; i++)
            {
                ListItem MonthItem = new ListItem();
                MonthItem.Text = i.ToString();
                this.MeetingStartMonthDdl.Items.Add(MonthItem);
            }
            for (int i = 1; i <= 0x1f; i++)
            {
                ListItem DateItem = new ListItem();
                DateItem.Text = i.ToString();
                this.MeetingStartDateDdl.Items.Add(DateItem);
            }
            this.MeetingEndYearDdl.Items.Clear();
            this.MeetingEndMonthDdl.Items.Clear();
            this.MeetingEndDateDdl.Items.Clear();
            ListItem tmpItemTo = new ListItem();
            tmpItemTo.Text = "----";
            this.MeetingEndYearDdl.Items.Add(tmpItemTo);
            ListItem tmpItemTo1 = new ListItem();
            tmpItemTo1.Text = "--";
            this.MeetingEndMonthDdl.Items.Add(tmpItemTo1);
            this.MeetingEndDateDdl.Items.Add(tmpItemTo1);
            for (int i = DateTime.Now.Year; i >= 0x78a; i--)
            {
                ListItem YearItem = new ListItem();
                YearItem.Text = i.ToString();
                this.MeetingEndYearDdl.Items.Add(YearItem);
            }
            for (int i = 1; i <= 12; i++)
            {
                ListItem MonthItem = new ListItem();
                MonthItem.Text = i.ToString();
                this.MeetingEndMonthDdl.Items.Add(MonthItem);
            }
            for (int i = 1; i <= 0x1f; i++)
            {
                ListItem DateItem = new ListItem();
                DateItem.Text = i.ToString();
                this.MeetingEndDateDdl.Items.Add(DateItem);
            }
            this.paperTypeDdl.Items.Clear();
            ListItem item = new ListItem();
            item.Text = string.Empty;
            item.Value = string.Empty;
            ListItem item1 = new ListItem();
            item1.Text = "《上海贝尔阿尔卡特》";
            item1.Value = "1";
            ListItem item2 = new ListItem();
            item2.Text = "《伙伴》";
            item2.Value = "2";
            ListItem item3 = new ListItem();
            item3.Text = "《方案与服务》";
            item3.Value = "3";
            ListItem item4 = new ListItem();
            item4.Text = "《阿尔卡特电信技术展望》";
            item4.Value = "4";
            this.paperTypeDdl.Items.Add(item);
            this.paperTypeDdl.Items.Add(item1);
            this.paperTypeDdl.Items.Add(item2);
            this.paperTypeDdl.Items.Add(item3);
            this.paperTypeDdl.Items.Add(item4);
            this.timeTypeDdl.Items.Clear();
            ListItem itemASBContractSign = new ListItem("与ASB重大合同签订信息", "itemASBContractSign");
            ListItem itemASBContractEffect = new ListItem("与ASB重大合同生效信息", "itemASBContractEffect");
            ListItem itemEVMeeting = new ListItem("高层会面信息", "itemEVMeeting");
            ListItem itemVisitingAbroad = new ListItem("出国拜访信息", "itemVisitingAbroad");
            ListItem itemASBTraining = new ListItem("客户参加ASB相关培训信息", "itemASBTraining");
            ListItem itemASBEvents = new ListItem("参加ASB会议，活动信息", "itemASBEvents");
            ListItem itemEvents = new ListItem("ASB参与的客户活动，会议，或同客户共同举行的活动", "itemEvents");
            ListItem itemResponsibleStaff = new ListItem("负责该客户的主要ASB员工", "itemResponsibleStaff");
            ListItem itemASBReception = new ListItem("ASB接待情况", "itemASBReception");
            ListItem itemCompetitorMeeting = new ListItem("同竞争对手会面", "itemCompetitorMeeting");
            ListItem itemCompetitorEvents = new ListItem("参加竞争对手的会议，活动信息", "itemCompetitorEvents");
            ListItem itemPic = new ListItem("图片信息", "itemPic");
            this.timeTypeDdl.Items.Add(itemASBContractSign);
            this.timeTypeDdl.Items.Add(itemASBContractEffect);
            this.timeTypeDdl.Items.Add(itemEVMeeting);
            this.timeTypeDdl.Items.Add(itemVisitingAbroad);
            this.timeTypeDdl.Items.Add(itemASBTraining);
            this.timeTypeDdl.Items.Add(itemASBEvents);
            this.timeTypeDdl.Items.Add(itemEvents);
            this.timeTypeDdl.Items.Add(itemResponsibleStaff);
            this.timeTypeDdl.Items.Add(itemASBReception);
            this.timeTypeDdl.Items.Add(itemCompetitorMeeting);
            this.timeTypeDdl.Items.Add(itemCompetitorEvents);
            Area[] areaAry = this.Principal.OwnArea;
            this.areaDdl.Items.Clear();
            for (int i = 0; i < areaAry.Length; i++)
            {
                ListItem tmpListItem = new ListItem();
                tmpListItem.Text = areaAry[i].AreaName;
                tmpListItem.Value = areaAry[i].AreaId.ToString();
                this.areaDdl.Items.Add(tmpListItem);
            }
            this.catDdl.Items.Clear();
            this.catDdl.DataSource = ManageCAT.GetCAT(new Guid(this.areaDdl.SelectedValue));
            this.catDdl.DataTextField = "CATGroupName";
            this.catDdl.DataValueField = "CATGroupId";
            this.catDdl.DataBind();
            this.regionDdl.DataSource = ManageProvince.GetProvince(new Guid(this.areaDdl.SelectedValue));
            this.regionDdl.DataTextField = "RegionName";
            this.regionDdl.DataValueField = "RegionId";
            this.regionDdl.DataBind();
        }

        private bool IsExistItem(ListItem tmpItem, ListBox tmpList)
        {
            for (int i = 0; i < tmpList.Items.Count; i++)
            {
                if (tmpItem.Value == tmpList.Items[i].Value)
                {
                    return true;
                }
            }
            return false;
        }

        protected override void OnInit(EventArgs e)
        {
            this.InitializeComponent();
            base.OnInit(e);
            this.Principal = this.Context.User as UserPrincipal;
        }

        private void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                this.SelectAuth();
            }
        }

        private void PrefTypeDdl_SelectedIndexChanged(object sender, EventArgs e)
        {
            string language = this.Session["language"].ToString();
            this.PrefValueDdl.DataSource = ManagePreference.GetPreferenceValue(new Guid(this.PrefTypeDdl.SelectedItem.Value));
            switch (language)
            {
                case "cn":
                    this.PrefValueDdl.DataTextField = "PreferenceValueNameCn";
                    break;

                case "en":
                    this.PrefValueDdl.DataTextField = "PreferenceValueNameEn";
                    break;
            }
            this.PrefValueDdl.DataValueField = "PreferenceValueId";
            this.PrefValueDdl.DataBind();
        }

        private void searchBtn_Click(object sender, EventArgs e)
        {
            this.Page.Session.Add("CompanyName", this.CompanyNameTbx.Text.Trim());
            this.Page.Session.Add("CustomerName", this.CustomerNameTbx.Text.Trim());
            this.Page.Session.Add("CustomerTitleTbx", this.CustomerTitleTbx.Text.Trim());
            this.Page.Session.Add("CustomerLevel", this.CustomerLevelDdl.SelectedValue);
            this.Page.Session.Add("Coupon", this.CouponTxb.Text.Trim());
            this.Page.Session.Add("TravelTool", this.TravelToolDdl.SelectedItem.Value);
            this.Page.Session.Add("GraduateSchool", this.GraduateSchoolTxb.Text.Trim());
            this.Page.Session.Add("Company", this.CompanyTxb.Text.Trim());
            this.Page.Session.Add("WorkPlace", this.WorkPlaceTxb.Text.Trim());
            this.Page.Session.Add("Hotel", this.HotelTxb.Text.Trim());
            this.Page.Session.Add("Major", this.MajorTxb.Text.Trim());
            this.Page.Session.Add("Tour", this.TourTxb.Text.Trim());
            this.Page.Session.Add("Degree", this.DegreeDdl.SelectedItem.Value);
            try
            {
                this.Page.Session.Add("PrefValue", this.PrefValueDdl.SelectedItem.Value);
                this.Page.Session.Add("PrefType", this.PrefTypeDdl.SelectedItem.Value);
            }
            catch (Exception)
            {
                this.Page.Session.Add("PrefValue", "00000000-0000-0000-0000-000000000000");
                this.Page.Session.Add("PrefType", "00000000-0000-0000-0000-000000000000");
            }
            this.Page.Session.Add("ImageInfo", this.ImageInfoTxb.Text.Trim());
            this.Page.Session.Add("NewsPaper", this.paperTypeDdl.SelectedValue);
            this.Page.Session.Add("Editor", this.editorTxb.Text.Trim());
            this.Page.Session.Add("CATId", this.catDdl.SelectedValue);
            this.Page.Session.Add("RegionId", this.regionDdl.SelectedValue);
            this.SetTimeInSession();
            base.Response.Redirect("~/Customer/CustomerInfoListPage.aspx?IsSearch=True", true);
        }

        private void SelectAuth()
        {
            if (this.Principal.OwnRole.TypeB == 0)
            {
                this.InitPage();
            }
            else if (this.Principal.OwnRole.TypeB == 1)
            {
                this.InitPage();
            }
            else if (this.Principal.OwnRole.TypeB == 2)
            {
                this.PrefValueDdl.Visible = false;
                this.PrefTypeDdl.Visible = false;
                this.DegreeDdl.Visible = false;
                this.searchBtn.Visible = false;
                this.CustomerNameTbx.Visible = false;
                this.CustomerTitleTbx.Visible = false;
                this.TravelToolDdl.Visible = false;
                this.GraduateSchoolTxb.Visible = false;
                this.CompanyTxb.Visible = false;
                this.WorkPlaceTxb.Visible = false;
                this.MeetingStartYearDdl.Visible = false;
                this.MeetingStartMonthDdl.Visible = false;
                this.MeetingStartDateDdl.Visible = false;
                this.MeetingEndYearDdl.Visible = false;
                this.MeetingEndMonthDdl.Visible = false;
                this.MeetingEndDateDdl.Visible = false;
                this.HotelTxb.Visible = false;
                this.MajorTxb.Visible = false;
                this.TourTxb.Visible = false;
                this.CompanyNameTbx.Visible = false;
                this.CouponTxb.Visible = false;
                this.lbCompanyName.Visible = false;
                this.lbCustomerName.Visible = false;
                this.lbCustomerTitle.Visible = false;
                this.lbPreferencesType.Visible = false;
                this.lbPreferencesValue.Visible = false;
                this.lbTravelHotel.Visible = false;
                this.lbTravelTool.Visible = false;
                this.lbStudyingExperience.Visible = false;
                this.lbDegree.Visible = false;
                this.lbMajor.Visible = false;
                this.lbGraduateSchool.Visible = false;
                this.lbWorkingExperience.Visible = false;
                this.lbCompany.Visible = false;
                this.lbWorkingPlace.Visible = false;
                this.lbFrom.Visible = false;
                this.lbTo.Visible = false;
                this.lbASBReception.Visible = false;
                this.lbHotel.Visible = false;
                this.lbTour.Visible = false;
                this.lbFromY.Visible = false;
                this.lbFromM.Visible = false;
                this.lbFromD.Visible = false;
                this.lbToY.Visible = false;
                this.lbToM.Visible = false;
                this.lbToD.Visible = false;
                this.lbCoupon.Visible = false;
                this.TravelToolDdl.Visible = false;
                this.lbBasicInfo.Visible = false;
                this.ImageInfoTxb.Visible = false;
                this.CustomerLevelDdl.Visible = false;
            }
        }

        private void SetFrom()
        {
            string language = this.Session["language"].ToString();
            string path = base.Server.MapPath("~/LanguageConfig.xml");
            this.lbCompanyName.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbCompanyName", language, path);
            this.lbCustomerName.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbCustomerName", language, path);
            this.lbCustomerTitle.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbCustomerTitle", language, path);
            this.lbPreferencesType.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbPreferencesType", language, path);
            this.lbPreferencesValue.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbPreferencesValue", language, path);
            this.lbTravelHotel.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbTravelHotel", language, path);
            this.lbTravelTool.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbTravelTool", language, path);
            this.lbStudyingExperience.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbStudyingExperience", language, path);
            this.lbDegree.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbDegree", language, path);
            this.lbMajor.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbMajor", language, path);
            this.lbGraduateSchool.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbGraduateSchool", language, path);
            this.lbWorkingExperience.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbWorkingExperience", language, path);
            this.lbCompany.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbCompany", language, path);
            this.lbWorkingPlace.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbWorkingPlace", language, path);
            this.lbFrom.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbFrom", language, path);
            this.lbTo.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbTo", language, path);
            this.lbASBReception.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbASBReception", language, path);
            this.lbHotel.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbHotel", language, path);
            this.lbTour.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbTour", language, path);
            this.lbFromY.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbFromY", language, path);
            this.lbFromM.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbFromM", language, path);
            this.lbFromD.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbFromD", language, path);
            this.lbToY.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbToY", language, path);
            this.lbToM.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbToM", language, path);
            this.lbToD.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbToD", language, path);
            this.lbCoupon.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbCoupon", language, path);
            this.searchBtn.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "searchBtn", language, path);
            this.lbCustomerLevel.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbCustomerLevel", language, path);
            this.lbImage.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbImage", language, path);
            this.lbBasicInfo.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbBasicInfo", language, path);
            this.lbNewsPaper.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbNewsPaper", language, path);
            this.lbCatDdl.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbCatDdl", language, path);
            this.lbRegionDdl.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbRegionDdl", language, path);
            this.lbAreaDdl.Text = ManageSystemConfig.GetSystemSetLanguage("CustomerInfoSearchPage", "lbAreaDdl", language, path);
        }

        private void SetFromImage()
        {
            switch (this.Session["language"].ToString())
            {
                case "cn":
                    this.iSearch.ImageUrl = "../images/Title_Search.jpg";
                    break;

                case "en":
                    this.iSearch.ImageUrl = "../images/Title_SearchEn.jpg";
                    break;
            }
        }

        private void SetTimeInSession()
        {
            DateTime startDateASBContractSign = new DateTime(0x708, 1, 1);
            DateTime endDateASBContractSign = new DateTime(0x270f, 1, 1);
            DateTime startDateASBContractEffect = new DateTime(0x708, 1, 1);
            DateTime endDateASBContractEffect = new DateTime(0x270f, 1, 1);
            DateTime startDateEVMeeting = new DateTime(0x708, 1, 1);
            DateTime endDateEVMeeting = new DateTime(0x270f, 1, 1);
            DateTime startDateVisitingAbroad = new DateTime(0x708, 1, 1);
            DateTime endDateVisitingAbroad = new DateTime(0x270f, 1, 1);
            DateTime startDateASBTraining = new DateTime(0x708, 1, 1);
            DateTime endDateASBTraining = new DateTime(0x270f, 1, 1);
            DateTime startDateASBEvents = new DateTime(0x708, 1, 1);
            DateTime endDateASBEvents = new DateTime(0x270f, 1, 1);
            DateTime startDateEvents = new DateTime(0x708, 1, 1);
            DateTime endDateEvents = new DateTime(0x270f, 1, 1);
            DateTime startDateResponsibleStaff = new DateTime(0x708, 1, 1);
            DateTime endDateResponsibleStaff = new DateTime(0x270f, 1, 1);
            DateTime startDateASBReception = new DateTime(0x708, 1, 1);
            DateTime endDateASBReception = new DateTime(0x270f, 1, 1);
            DateTime startDateCompetitorMeeting = new DateTime(0x708, 1, 1);
            DateTime endDateCompetitorMeeting = new DateTime(0x270f, 1, 1);
            DateTime startDateCompetitorEvents = new DateTime(0x708, 1, 1);
            DateTime endDateCompetitorEvents = new DateTime(0x270f, 1, 1);
            DateTime startDatePic = new DateTime(0x708, 1, 1);
            DateTime endDatePic = new DateTime(0x270f, 1, 1);
            for (int i = 0; i < this.selectedTimeLB.Items.Count; i++)
            {
                string[] textAry = this.selectedTimeLB.Items[i].Value.Split(new char[] { '@' });
                if (textAry[0] == "itemASBContractSign")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateASBContractSign = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateASBContractSign = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemASBContractEffect")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateASBContractEffect = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateASBContractEffect = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemEVMeeting")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateEVMeeting = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateEVMeeting = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemVisitingAbroad")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateVisitingAbroad = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateVisitingAbroad = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemASBTraining")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateASBTraining = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateASBTraining = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemASBEvents")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateASBEvents = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateASBEvents = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemEvents")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateEvents = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateEvents = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemResponsibleStaff")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateResponsibleStaff = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateResponsibleStaff = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemASBReception")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateASBReception = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateASBReception = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemCompetitorMeeting")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateCompetitorMeeting = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateCompetitorMeeting = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemCompetitorEvents")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDateCompetitorEvents = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDateCompetitorEvents = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
                if (textAry[0] == "itemPic")
                {
                    string[] from = textAry[1].Split(new char[] { '-' });
                    string[] to = textAry[2].Split(new char[] { '-' });
                    startDatePic = new DateTime(Convert.ToInt32(from[0]), Convert.ToInt32(from[1]), Convert.ToInt32(from[2]));
                    endDatePic = new DateTime(Convert.ToInt32(to[0]), Convert.ToInt32(to[1]), Convert.ToInt32(to[2]));
                }
            }
            this.Page.Session.Add("PicStart", startDatePic);
            this.Page.Session.Add("PicEnd", endDatePic);
            this.Page.Session.Add("CompetitorEventsStart", startDateCompetitorEvents);
            this.Page.Session.Add("CompetitorEventsEnd", endDateCompetitorEvents);
            this.Page.Session.Add("CompetitorMeetingStart", startDateCompetitorMeeting);
            this.Page.Session.Add("CompetitorMeetingEnd", endDateCompetitorMeeting);
            this.Page.Session.Add("ASBReceptionStart", startDateASBReception);
            this.Page.Session.Add("ASBReceptionEnd", endDateASBReception);
            this.Page.Session.Add("ResponsibleStaffStart", startDateResponsibleStaff);
            this.Page.Session.Add("ResponsibleStaffEnd", endDateResponsibleStaff);
            this.Page.Session.Add("EventsStart", startDateEvents);
            this.Page.Session.Add("EventsEnd", endDateEvents);
            this.Page.Session.Add("ASBEventsStart", startDateASBEvents);
            this.Page.Session.Add("ASBEventsEnd", endDateASBEvents);
            this.Page.Session.Add("ASBTrainingStart", startDateASBTraining);
            this.Page.Session.Add("ASBTrainingEnd", endDateASBTraining);
            this.Page.Session.Add("VisitingAbroadStart", startDateVisitingAbroad);
            this.Page.Session.Add("VisitingAbroadEnd", endDateVisitingAbroad);
            this.Page.Session.Add("EVMeetingStart", startDateEVMeeting);
            this.Page.Session.Add("EVMeetingEnd", endDateEVMeeting);
            this.Page.Session.Add("ASBContractEffectStart", startDateASBContractEffect);
            this.Page.Session.Add("ASBContractEffectEnd", endDateASBContractEffect);
            this.Page.Session.Add("ASBContractSignStart", startDateASBContractSign);
            this.Page.Session.Add("ASBContractSignEnd", endDateASBContractSign);
        }
    }
}

